<?php

namespace common\enums;

use yii\base\Model;
use common\models\hardware\FeiE;
use common\models\hardware\YiLianYun;

/**
 * 硬件关系
 *
 * Class HardwareTypeEnum
 * @package common\enums
 * @author YiiFrame <21931118@qq.com>
 */
class HardwareNameEnum extends BaseEnum
{
    /** @var string 小票打印机 */
    const YI_LIAN_YUN = 'yiLianYun';
    const FEI_E = 'feiE';
    /** @var string 其他 */

    /**
     * @return array|string[]
     */
    public static function getMap(): array
    {
        return [
            self::YI_LIAN_YUN => '易联云',
            self::FEI_E => '飞鹅云',
        ];
    }

    /**
     * 模型
     *
     * @param $key
     * @return Model|string
     */
    public static function getModelValue($key)
    {
        return static::getModelMap()[$key] ?? '';
    }

    /**
     * 模型对应
     *
     * @return array|string[]
     */
    public static function getModelMap(): array
    {
        return [
            self::YI_LIAN_YUN => new YiLianYun(),
            self::FEI_E => new FeiE(),
        ];
    }

    /**
     * 组别
     *
     * @param $key
     * @return string|string[]
     */
    public static function getGroupValue($key)
    {
        return static::getGroup()[$key] ?? '';
    }

    /**
     * 组别对应
     *
     * @param $type
     * @return \string[][]
     */
    public static function getGroup()
    {
        return [
            HardwareTypeEnum::RECEIPT_PRINTER => [
                self::YI_LIAN_YUN => '易联云',
                self::FEI_E => '飞鹅云',
            ],
        ];
    }
}